package cn.ihelloworld.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.ihelloworld.bean.Comment;
import cn.ihelloworld.dao.ICommentDao;
import cn.ihelloworld.dao.Pagation;
import cn.ihelloworld.service.ICommentService;

@Service
@Transactional
public class CommentServiceImpl implements ICommentService {
	
	@Autowired
	private ICommentDao commentDao;

	@Override
	public Comment get(String id) {
		// TODO Auto-generated method stub
		return commentDao.get(id);
	}

	@Override
	public List<Comment> select(Comment t) {
		// TODO Auto-generated method stub
		return commentDao.select(t);
	}

	@Override
	public Pagation<Comment> selectForPage(Comment t, int currentPage,
			int pageSize) {
		// TODO Auto-generated method stub
		return commentDao.selectForPage(t, currentPage, pageSize);
	}

	@Override
	public void saveOrUpdate(Comment t) {
		// TODO Auto-generated method stub
		commentDao.saveOrUpdate(t);

	}

	@Override
	public void delete(String id) {
		// TODO Auto-generated method stub
		commentDao.delete(id);

	}

	@Override
	public void delete(String[] ids) {
		// TODO Auto-generated method stub
		commentDao.delete(ids);

	}

	@Override
	public void saveOrUpdate(List<Comment> comments) {
		// TODO Auto-generated method stub
		for(Comment t:comments){
			commentDao.saveOrUpdate(t);
		}
	}

}
